home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Free 25
/
Commodore_Free_Issue_25_2008_Commodore_Computer_Club.d64
/
t.b guide 10.1
< prev
next >
Wrap
Text File
|
2023-02-26
|
11KB
|
353 lines
u
In the Beginning Chapter 10, Section 1
\Lord Ronin from Q-Link\
-------------------------
Already we have used the print
statement to make animated graphics.
We used the poke command in the last
instalment to make a more complicated
animation. Both of those were
technically animation, but nothing
like the games you have seen or I
talked about earlier, we used only one
little character from the 256 that
exist in the computer. OK clarify
that, from the stock ones that exist.
Remember that you can create your own
characters.
Well you saw that moving those little
graphics symbols around took some
typing work. Also it took a bit of
knowledge that at present we just
don't have in our memory. By that I
mean knowing things like the value to
variables and how to structure the
lines. OK a big action game would be
pretty much impossible to create in
the way we have done. Simply put, we
won't always be limited to just a
character from the character set. You
would like a larger thing on the
screen for the game right?
That is where the idea of a sprite
comes into play <sorry for that pun>.
What then is a sprite? A small
somewhat evil creature in an AD&D
game. No wait, sorry mind was in the
wrong place. <LOL>
"A Sprite is a high-resolution
programmable object that can be made
into just about any shape through
BASIC commands. The object can be
easily moved around the screen by
simply telling the computer the
position the sprite should be moved
to. The computer takes care of the
rest." 4th paragraph page 68 in the
user's manual.
Strange words huh man? The book goes
on to say that the sprite has "more
power than just that". Colours can be
changed. Collision detection, move in
front or behind each other, change in
size and more.
Right that takes care of the two
paragraphs quoted and information and
you are more confused than I was the
first time I read the passages. Now
then before you need to take a nitro
tab, I'll try to explain all this
weird talk.
To the best of my knowledge all the 8
bit games played with sprites.
Asteroids, defender, pacman and the
like. OK maybe that isn't the correct
word to use. I'm a lamer as you
remember. Still the point is that
these games I mentioned above, at
least on the C= use sprites. That can
give you an idea of what a sprite can
become in your future work.
Yes you can change the colour of a
sprite, you can also change the size
of a sprite. Three things that I
quoted above come into my explanation
of a sprite. Moving in front or behind
and collisions. Sprite collisions are
a strange concept and term, the guy
that got me to understand it, to some
degree was watching me try to play a
flying game. Sorry don't really
remember the game, may have been
Zennon, anyway as I kept shooting the
other space ships. He would just
whisper out "Collision". When I
crashed the space ship, he would shout
out "Collision". Wanted to deck him at
times., but he did show me the
connection of what I was doing to the
sprite collision thing. I'll admit
that he also showed me a cartridge
that plugged into the C=64 and then
pointed out an option called something
like, collision killer. Yeah that is
what it did, I could smash up and not
be killed off in the game. I tell you
that I then bought that cart for my
collection.
Basically what I am saying is that you
can make a shoot 'em up game, blast at
the bad guy, your shot is a sprite,
the bad guy is a sprite and your shot
hits, and because it hits in the right
place, you make a collision with the
bad guy. Simple idea and it took me
months to understand what was being
said.
On screen it was easier to see the
idea of moving in front of something
or behind it. There is a book that I
want to get that has a demo disk of
the things that are covered in the
book. Sprites are one of them, I
remember that the book showed a car
that drove by a garage, the car came
back again and entered into the
garage. Now this garage had a simple
window in it, and you could see the
car, or part of it through the window.
That is what clicked in my mind for
putting a sprite in front of another
one, or even behind it, and making it
look good.
Some bad examples are some games that
I have played. One that comes to my
mind is an aeroplane game. Simple
sprites, with a couple of planes that
are controlled by the joystick, you
basically Blast unlimited bullets at
each other. Its a rather fun simple,
little thinking, game. Sprite
collisions here are the bullets
hitting the planes. Now it would have
been real nice if the clouds where
something you could go behind, but no
they are as hard as granite. Hit a
cloud and you don't go behind or in
front of it, you crash and burn.
Examples out of the way, here we are
only going to make some simple
sprites. There are books and programs
to create sprites. Some of the little
programs I have used make the process
simpler than what we will be doing
next. For those that have a 128. There
is a sprite maker in the 40c mode.
The book tells us that making a sprite
isn't as difficult as they or I make
it out to be. Well it is something
that you will need to do more than
once to get the full feel of making a
sprite by scratch.
We have a separate picture maker in
the C=64 for sprites. "This picture
maker handles the video display." So
says the book. Gee man that sounds so
friendly! We are told that the
computer handles the tasks of keeping
track of the characters and graphics
and the colour and of moving the
object around. Wait for it, gets
confusing real soon.
Time for that real soon part then.
There are 46 different "ON/OFF"
locations "which act like internal
memory locations, each of these
locations breaks down into a series of
8 blocks. And each block can be either
'on' or 'off'."
A lot of members just tossed the book
to the side at that point. The book
stopped being friendly and got
complicated. Before you blank out .
Take that stuff and put it off to the
side for a good amount of time. What
we are going to do is poke things into
these areas to make stuff happen. On
screen again I repeat that there are
programs that take a lot of this work
out of the task of making sprites.
Eight memory locations are used. Tell
you now that you have only 8 sprites
at a time "ACTIVE" on the screen. You
can have more waiting to be used
though.
You may want to make a grid chart here
to help you draw out your sprites. A
sprite is 24 dots wide and 21 dots (or
pixels) tall. "Sprites are displayed
in a special independent 320 dot wide
by 200 dot high area. However you can
use your sprite with any mode
high-resolution, low resolution, text,
etc." And I know that makes very
little, or no sense at this moment.
What is going to happen is that we are
going to make a balloon character, and
have it float across the screen. We
will also be adjusting that in a few
steps. The book now wants you to grab
some paper, and they say graph paper
as one of the options, we are going to
do a little bit of work.
Below is a very crudely made example
of the graph they would like you to
make. 24 columns wide by 21 rows tall.
Sorry can't do the grid stuff as
precise as I would like. Hoping that
you can see what I am trying to
create.
SERIES SERIES SERIES
1 2 3
1 1 1
2631 2631 2631
842684218426842184268421
+------------------------+
1 .........#######........
2 .......###########......
3 ......#############.....
4 ......#####...#####.....
5 .....#####.###..####....
6 .....#####.###.#####....
7 .....#####.###..####....
8 ......#####...#####.....
9 ......#############.....
R 10 ......#############.....
O 11 ......#.#########.#.....
W 12 .......#.#######.#......
13 .......#..#####..#......
14 ........#..###..#.......
15 ........#..###..#.......
16 .........#..#..#........
17 .........#..#..#........
18 ..........#####.........
19 ..........#####.........
20 ..........#####.........
21 ...........###..........
+------------------------+
1 1 2 2
1 5 0 5 0 4
COLUMN
This is what we will use to create the
basic sprite drawing. Make a bit more
sense in a moment. If it will help,
add the word "data" at the end of each
row. This is a suggestion from the
book. What I can't give you here is
the actual illustration of the balloon
that's created on that grid. But I do
have the numbers to plug into the
actual programme, or I think that I do
<VBG>.
What is happening here is that you
create the drawing in the grids under
the numbers. Just fill in the grid as
it fits under the number. I'll suspect
that you will try your own design
after this bit. OK we are going to
look at this drawing, I have to use
the balloon one. You can see that
there are squares that are filled and
those that are blank. What this can be
translated to in your mind, and of
course the C=64 is that the filled
areas are "ON" and the empty or blank
areas are "OFF". Not to scare you
away, but this is the start of binary.
Filled areas are a 1 and empty areas
are a 0.
Next you have to convert the image
into something that the computer can
use. All computers work with numbers.
Meaning we now must convert this image
into numbers. Since there are three
series from 128 to 1 in the grid.
There must be three sets of some sort
of number system. But how to create
them and what do they look like?
For this I must use the illustration
from the book. Going over that one we
have nothing in the first set of
numbers. Therefore the total of that
is 0. Second set or series of numbers
has something in the boxes. Book has
the little thing I am recreating
below, as a way for you to work out
the numbers. This is for the 1st line,
second series of the book illustration
128 64 32 16 8 4 2 1
+----+----+----+----+----+----+----+---+
0 1 1 1 1 1 1 1
+----+----+----+----+----+----+----+---+
^ ^ ^ ^ ^ ^ ^ ^
0 + 64 + 32 + 16 + 8 + 4 + 2 + 1
= 127
Wow that looks crazy, what is
happening in that thing?
Remember that it is the second set or
series in the grid. Three of them need
to be done for each row. But what you
are doing is simply marking on this
little work chart if there is anything
in the 128 column on row one and the
second set. Here there isn't. So a 0
is what you put underneath. Ah but in
the 64 one we do have a something in
the illustration. So in series 2 row
one under the heading of 64. You place
a 1. Once you have completed that
method of marking down, if there is or
isn't a something in the grid square.
You next go down to the area under the
up arrows I placed there in the
example.
CONTINUED IN SECTION 2